<?php $yearstr=$str->getafteryear(0);?>         	
<?php
$user=$session->read('User');
$companyid=$session->read("companyid");
?>
<div class="right_side_operate_area">
	<div class="right_side_title left">
		<h2>
		<?php 
		$companyname=$session->read("companyname");
		echo $html->link($companyname,"/companys/showinfosummary/".$companyid);
		?>
		</h2>
		<div class="clear"></div>
	</div>
    <div class="right item_add_btn">
    <?php 
    	$id=$form->value('CompPerson.id');
    	$str_title=__("Add",true);
		if($id){
			$str_title=__("Edit",true);
		}
		echo $html->link(__("Cancel",true).$str_title,"/companys/person/");
    ?>
    </div>
    <div class="clear"></div>
</div>
<div class="right_side_scollbar">
    <div class="detail_info_panel">
    	<?php echo $form -> create('persons', array('url' => '/companys/editpersonnum/','type'=> 'post') ); ?>
<?php 
	if (!empty($persontypes)){
		if (!is_array($persontypes)){//如果数据不为数组，则把它拼为数组
			$persontypes[] = $persontypes;
		}
		foreach ($persontypes as $key=>$value){
			if (!empty($key)){
				$showPNvalue = array();
				if (is_array($personnums)){//至少有两条记录
					foreach ($personnums as $personnum){
						if ($personnum['CompPersonNum']['type_id'] == $key){
							$showPNvalue = $personnum['CompPersonNum'];
						}
					}
				}else{//只有一条记录
					if ($personnums['CompPersonNum']['type_id'] == $key){
						$showPNvalue = $personnums['CompPersonNum'];
					}
				}
?>
			<div class="details_item_line">
            	<div class="details_item">
            	    <div class="form_left_title left"><?php echo $value;?>：</div>
            	    <div class="form_right_e_input left"><input type="text" name="personnum[]" value="<?php echo empty($personnums)?'':$showPNvalue['number'];?>" onkeydown="inputOnlyNum(event)" onkeypress="checkIfNum(event)"/></div>
            	</div>
        	</div>
    		<input type="hidden" name="type_id[]" value="<?php echo $key;?>"/> 
<?php			
			}
		}
	}    		
?>
			<div class="details_item_line edit_form_btn">
            	<div class="details_item">
            		<div class="form_left_title left"></div>
                	<div class="form_add_submit left">
	                	<input type="submit" value="保存">	                
	                	<input type="hidden" name="companyid" value="<?php echo $companyid;?>" id="CompPersonId">                
	                </div>
            	</div>
        	</div>
    	</form>
    </div>
</div>